// Plasma Gun (Doom)

ACTOR IDMPlasmaGun : IDMWeapon replaces PlasmaRifle
{
  Weapon.SlotNumber 6
  Weapon.SelectionOrder 300
  Weapon.Sisterweapon "PlasmaGunLevel2"
  Weapon.AmmoUse 1
  Weapon.AmmoGive 50
  Weapon.AmmoType "IDMCell"
  Weapon.Kickback 200
  Weapon.PreferredSkin "PlasmaMarine"
  Inventory.PickupMessage "Plasma Gun!"
  Tag "Plasma Gun"
  States
  {
  Ready:
    PLSG A 1 A_WeaponReady
    Loop
  Deselect:
    PLSG A 0 A_Lower
    PLSG A 0 A_Lower
    PLSG A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    PLSG A 0 A_Raise
    PLSG A 0 A_Raise
    PLSG A 1 A_Raise
    Loop
  Fire:
	PLSG A 0 A_GunFlash
	PLSG A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
  Normal:
    PLSG A 2 A_FireCustomMissile("IDMPlasmaBall",0,1)
	PLSG A 1 A_GunFlash("Flash2")
    TNT1 A 0 A_ReFire
    PLSG B 20
    Goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	PLSG A 2 A_FireCustomMissile("ExtremePlasmaBall",0,1)
	PLSG A 1 A_GunFlash("Flash2")
    TNT1 A 0 A_ReFire
    PLSG B 20
    Goto Ready
  Flash:
    PLSF A 2 Bright A_Light1
    PLSF B 2 Bright A_Light1
    Goto LightDone
  Flash2:
	PLSG A 2 Bright A_Light1
	Goto LightDone
  Spawn:
    PLAS A -1 Bright
    Stop
  }
}

ACTOR PlasmaGunLevel2 : IDMPlasmaGun
{
  Weapon.Sisterweapon "IDMPlasmaGun"
  Weapon.AmmoUse 1
  +POWERED_UP
  +NOAUTOAIM
  States
  {
  Fire:
	PLSG A 0 A_GunFlash
	PLSG A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
  Normal:
    PLSG A 2 A_FireCustomMissile("IDMPlasmaBall2",0,2)
	PLSG A 1 A_GunFlash("Flash2")
    TNT1 A 0 A_ReFire
    PLSG B 20
    Goto Ready
  Quad:
	TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	PLSG A 2 A_FireCustomMissile("ExtremePlasmaBall2",0,2)
	PLSG A 1 A_GunFlash("Flash2")
    TNT1 A 0 A_ReFire
    PLSG B 20
    Goto Ready
  }
}

// Plasma Gun's Plasma

ACTOR IDMPlasmaBall : PlasmaBall replaces PlasmaBall
{
  Speed 40
  Damage (5 * random(1,20))
  +RANDOMIZE
  -NOTELEPORT
  +SKYEXPLODE
  Alpha 1
  Obituary "%o was melted by %k's Plasma Gun."
  Seesound "weapons/plasmaf"
  DamageType "Plasma"
  Decal Plasmascorchlower
  Decal Plasmascorch
  States
  {
  Spawn:
    PLSS AB 4 Bright
    Loop
  Death:
	TNT1 A 0
	PLSE A 0 A_Explode(random(1,5),64,1,1,64)
	PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
	PLSE BCDE 3 Bright
	Stop
  XDeath:
	PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
	PLSE BCDE 3 Bright
    Stop
  }
}

ACTOR ExtremePlasmaBall : IDMPlasmaBall
{
	+EXTREMEDEATH
	States
	{
	XDeath:
		TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
		PLSE A 4 Bright A_Playsound("weapons/plasmax",0,0.25)
		PLSE BCDE 3 Bright
		Goto Death
	}
}

ACTOR IDMPlasmaBall2 : IDMPlasmaBall
{
  Speed 35
  Damage (5 * random(1,30))
  RenderStyle Add
  ProjectileKickBack 200
  Decal Plasmascorchlower
  Seesound "weapons/plasma2f"
  Deathsound "weapons/plasma2x"
  MaxTargetRange 1
  +SEEKERMISSILE
  States
  {
  Spawn:
    BAL8 AAAABBBB 1 Bright A_SeekerMissile(0,4.25,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,255,1)
    Loop
  Death:
	TNT1 A 0
    BAL8 A 0 A_Explode(random(1,5) * 5,64,1,1,64)
    BAL8 B 4 Bright A_Playsound("weapons/plasma2x",0,0.25)
    BAL8 CDE 3 Bright
    Stop
  }
}

ACTOR ExtremePlasmaBall2 : IDMPlasmaBall2
{
	ProjectileKickback 400
	+EXTREMEDEATH
	States
	{
	XDeath:
		TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
		Goto Death
	}
}